package musicstore.biz.impl;

import java.util.List;
import musicstore.biz.UserBiz;
import musicstore.entity.User;
import musicstore.mapper.UserMapper;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserBizImpl implements UserBiz {
	@Autowired
	private UserMapper userMapper;
	
	public List<User> getAll() {
		return userMapper.getAll();
	}

	public User fetchUserByUsername(String username) {
		return userMapper.fetchUserByEmail(username);
	}

	public User fetchUserByEmail(String email) {
		return userMapper.fetchUserByEmail(email);
	}

	public List<User> getUsers(int roleId) {
		return userMapper.getUsers(roleId);
	}

	@Override
	public User checkLogin(String username, String password) {
		return userMapper.checkLogin(username, password);
	}



	@Override
	public void register(User user) {
		userMapper.register(user);

	}

	@Override
	public void update(User user) {
		userMapper.update(user);

	}

	@Override
	public void delete(int id) {
		userMapper.delete(id);

	}
}
